#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

#define	MAX_L	500

int main() {

	int i, j, N;
	vector<int> b;
	
	cin >> N;
	
	while(N--)
	{
		cin >> i;
		b.push_back(i);
	}
	
	sort(b.begin(), b.end());
	
	j = 0;
	
	i = 1;
	
	while(i < b.size() && (b[i - 1] + b[i] <= b[b.size() - 1]))
	{
		i++;
		j++;
	}

	if(b.size() - j < 3)
		cout << "0\n";
	else
		cout << b.size() - j << endl;
	
	return 0;
}
